-- class name usage example
package Example3 is
type Test is class
-- Wrong! This would lead to an infinite recursion
-- (An incomplete class type could be used here).
class attribute value : Test;
class attribute value2 : integer;
-- correct, member functions may have this class as parameter
function get return integer;
for variable
procedure put( value : integer );
procedure CopyTo( variable a : out Test );
procedure CopyFrom( constant a : in Test );
end for;
end class Test;
end package Example3;
package body Example3 is
type Test is class body
function get return integer is
begin
return value2;
end;
for variable
procedure put( value : integer ) is
begin
value2 := value;
end;
procedure CopyTo( variable a : out Test ) is
begin
-- Attributes of foreign objects with the same
-- class type are private to the object. We have
-- to access it via a member function.
a.put( value2 );
end;
procedure CopyFrom( constant a : in Test ) is
begin
value2 := a.get;
end;
end for;
end class body Test;
end package body Example3;